<select id="{{statementName}}" parameterType="map" resultMap="{{resultMap}}">
    SELECT * FROM {{collection.targetTable}} WHERE
    {{#collection.joinColumns}}
        {{^-first}} AND {{/-first}}
        {{name}} = #{ {{referencedColumnName}} }
    {{/collection.joinColumns}}
    {{#collection.orderBy}}
    ORDER BY {{collection.order}}
    {{/collection.orderBy}}
</select>
